<template>
	<view>
		<uni-data-select
			v-model="localValue"
			:localdata="field.options"
			@change="onChange"
			:disabled="!isEdit"
		  ></uni-data-select>
	</view>
</template>

<script>
export default {
  props: {
    value: Number,
    field: Object,
    isEdit: Boolean,
  },
  
  data() {
  	return {
  		localValue: this.value // 初始化本地副本
  	}
  },
  
  watch: {
  	value(newVal) {
  		this.localValue = newVal // 当prop变化时更新本地值
  	}
  },
  
  methods: {
    onChange(e) {
	  // 触发事件
	  this.$emit('update-value', e); 
    },
  },
}
</script>

<style>

</style>
